<%@ page contentType="text/html;charset=UTF-8"%> 
<%@ page import="java.util.*" %>
<%@ page import="com.yfeng.user.model.*" %>
<%
	String pageHtml = (String)request.getAttribute("pageHtml");
	String groupname = (String)request.getAttribute("groupname");
	List groupList=(List)request.getAttribute("groupList");
	User currUser=(User)session.getAttribute("currUser");
	String isAdmin=String.valueOf(currUser.getType());
	List permissionList=(List)request.getAttribute("permissionList");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>无标题文档</title>
<link href="${pageContext.request.contextPath}/common/themes/App_Themes/default/Style.css" rel="stylesheet" type="text/css" />
 <script src="${pageContext.request.contextPath}/common/js/common.js" type="text/javascript"></script>
 <script type="text/javascript" src="${pageContext.request.contextPath }/common/js/jquery-1.4.2.min.js"></script>
</head>

<body class="layout_body">
<div id="layout_container">

<div id="layout_mainContent">
    <!-- begin #layout_mainContent -->
    <!-- begin #box_table专用于grid -->
    <table   border="0" cellspacing="0" cellpadding="0" class="box_table">
      <tr>
        <td class="box_top_left_grid"></td>
        <td class="box_top_center_grid">
         <!-- 导航 -->
        <div class="box_top_center_grid_text"> 当前位置：<a href="#">首页</a> >> 系统管理 >> 用户组列表</div>
        <!-- 导航 -->
        </td>
        <td class="box_top_right_grid"></td>
      </tr>
      <tr>
        <td class="box_left"></td>
        <td>

        <!-- 内嵌按钮-->
        <table class="layout_grid_function">
            <form action="${pageContext.request.contextPath}/admin/groupListPage.do" method="post" id="queryForm" name="queryForm" ><tr><td>
         组名：<input type="text" name="groupname"  class="form_query" value="<%=groupname %>" />
           <input type="submit" class="button_original_yellow"  value="查询"/>

          </td>
         

          </tr>
          </form>
          </table>
          <!-- 内嵌按钮-->
          <form name="frmList" action="${pageContext.request.contextPath}/admin/delgroup.do" method="post" id="delForm">
              <input type="hidden" name="act" value="delall"/>
              
            	<%if("1".equals(isAdmin) ||("2".equals(isAdmin) && permissionList.contains("11"))){%>
               <input type="button" class="button_original_yellow" size="80" value="添加组" onclick="window.location='${pageContext.request.contextPath}/admin/addgroup_page.do'"/>
           		<%}if("1".equals(isAdmin) ||("2".equals(isAdmin) && permissionList.contains("12"))){%>
        <input type="button" class="button_original"  value="删除" id="del"/>
       <%} %>
       
         <!--内嵌内容表格-->
         <table   border="0" cellspacing="0" cellpadding="0" class="box_table">
      <tr>
        <td class="box_top_left_content"></td>
        <td class="box_top_center_content tac">用户组列表</td>
        <td class="box_top_right_content"></td>
      </tr>
      <tr>
        <td class="box_left_content"></td>
        <td class="tdPadding">
<!--内容-->
		<table width="100%" border="0" cellspacing="1" cellpadding="1" class="grid_table">
		<tr class="grid_table_head">
                    <td><input type="checkbox" name="checkall" id="checkall"/>&nbsp;</td>

  <td>序号</td>
    <td>组名</td>
   
    <td>操作</td>
  </tr>
 <% for(int i=0;i<groupList.size();i++){
		Map m=(Map)groupList.get(i);
		
	%>
  <tr>
      <td align="center"><input type="checkbox" id="id" name="id" value="<%=m.get("id").toString() %>"/>&nbsp;</td>
      <td><%=m.get("id").toString() %>&nbsp;</td>
    <td><%=m.get("name").toString() %>&nbsp;</td>
  
   
   
       <td>
       <%if("1".equals(isAdmin) ||("2".equals(isAdmin) && permissionList.contains("13"))){%>
       <a href="${pageContext.request.contextPath}/admin/modgroup_page.do?id=<%=m.get("id").toString() %>">修改</a> 
       <%}if("1".equals(isAdmin) ||("2".equals(isAdmin) && permissionList.contains("12"))){%>
       <a href="${pageContext.request.contextPath}/admin/delgroup.do?id=<%=m.get("id").toString() %>">删除</a>
       <%} %>&nbsp;
       </td>
     
  </tr>
<%} %>
</table>
<!--内容-->

        </td>
        <td class="box_right_content"></td>
      </tr>
      <tr>
        <td class="box_bottom_left_content"></td>
        <td class="box_bottom_center_content">

		<!--内嵌分页及工作流按钮-->
      <div class="layout_grid_page_workflow">

         <div class="layout_grid_page tac">
        <%=pageHtml %>
         </div>
      </div>
         <!--内嵌分页按钮-->

		</td>
        <td class="box_bottom_right_content"></td>
      </tr>
    </table>
      </form>



        </td>
        <td class="box_right"></td>
      </tr>
      <tr>
        <td class="box_bottom_left"></td>
        <td class="box_bottom_center"></td>
        <td class="box_bottom_right"></td>
      </tr>
    </table>
    <!-- end #box_table -->


    <!-- end #layout_mainContent -->
</div>
</div>

</body>
</html>
<script>

    function doAction(act)
    {
        if(act=='sp'){
        frmList.act.value="sp";
        frmList.submit();
        }
        else if(act=="star"){
        frmList.act.value="star";
        frmList.submit();
        }
        else if(act=="indexstar"){
        frmList.act.value="indexstar";
        frmList.submit();

        }
    }
    $(document).ready(function(){
        
    $("#checkall").click( 
     		function(){ 
     		if(this.checked){ 
     		$("input[name='id']").each(function(){this.checked=true;}); 
     		}else{ 
     		$("input[name='id']").each(function(){this.checked=false;}); 
     		} 
     		} 
     		);
    $("#del").click(function(){
		var item = $(":checkbox[name='id']:checked");
		if(item.length==0){
			alert("对不起，请选择一个组！");
			return;
		}
		$("#delForm").submit();
	});
    });
    </script>